export { china } from './china';
export { symbol } from './symbol';

export let api = '';
export let beApi = '';
export let ws = '';

if (process.env.NODE_ENV === 'dev') {
  api = 'http://api.zqd.com';
  beApi = 'http://api.zqd.com';
  ws = 'ws://api.zqd.com';
} else if (process.env.NODE_ENV === 'prod') {
  api = 'http://api.newagirl.com';
  beApi = 'http://api.newagirl.com';
  ws = 'ws://api.newagirl.com';
} else if (process.env.NODE_ENV === 'eh') {
  api = 'http://api.zqd.com';
  beApi = 'http://api.zqd.com';
  ws = 'ws://api.zqd.com';
}

export const num2symbol: any = {};

export const symbol2num: any = {};

export const point = 8;

export const session = {
  secret: 'eh', // 对session id 相关的cookie 进行签名
  resave: false,
  saveUninitialized: true, // 是否保存未初始化的会话
  cookie: {
    domain: '.zqd.com',
    maxAge: 1000 * 60 * 3, // 设置 session 的有效时间，单位毫秒
  },
};

export const host = '182.254.243.206';

export const mongo = {
  url: `mongodb://${host}:27017/faya`,
};

export const sessionStore = {
  url: mongo.url,
  host: host,
  port: 27017,
  collection: 'sessions', // 存在哪个集合里，默认为sessions
  ttl: 10, // session过期时间
  autoRemove: 'native', // mongo2.2+自动移除过期的session，disable为禁用
  autoRemoveInterval: 10, // 移除过期session间隔时间,默认为10分钟
  touchAfter: 24 * 3600, // 同步session间隔，默认每次请求都会同步到数据库
};

export const proto = 'http://';

export const domainMain = `zqd.com`;

// just use for set cookie
export const domainCookie = `.${domainMain}`;

// 客户端
export const domainC = `${proto}www.${domainMain}`;
// 商家端
export const domainB = `${proto}b.${domainMain}`;

export const isEmail = 1;
export const isPhone = 2;

export const isDebug = true;

// 过期时间 秒
export const phoneCode = {
  time: 60,
};

export const emailCode = {
  time: 60,
};

export const notuser = {
  msg: '用户不存在',
  code: '1000',
};

export const pwderr = {
  msg: '密码错误',
  code: '1001',
};

export const codeerr = {
  expired: {
    msg: '验证码过期',
    code: '1002',
  },
  wrong: {
    msg: '验证码不正确 ',
    code: '1003',
  },
};

export const user = {
  has: {
    msg: '用户已存在',
    code: '1006',
  },
  username: {
    msg: '用户名不正确',
    code: '1007',
  },
};

export const email = {
  sender: '13370277157@sina.cn',
  pwd: '498757352bb',
  host: 'smtp.sina.cn',
};

export const msg = {
  appId: '1400124463',
  appKey: '1f93ee3cf1267c696689f40bac3742ef',
};

// 天 分类
export const D = [
  {
    name: '1天', // 1天
    code: '1',
  },
  {
    name: '2天', // 1天
    code: '2',
  },
  {
    name: '3天', // 1天
    code: '3',
  },
  {
    name: '4天', // 1天
    code: '4',
  },
  {
    name: '5天', // 1天
    code: '5',
  },
];

export const goodType = [
  {
    name: '水上运动',
    code: '10',
    children: [
      {
        name: '潜水',
        code: '1001',
      },
    ],
  },
  {
    name: '类a',
    code: '11',
    children: [
      {
        name: '类a子',
        code: '1101',
        children: [
          {
            name: '类a子子',
            code: '110101',
          },
        ],
      },
    ],
  },
];
